package com.woohua.demo.stream;

import com.woohua.demo.stream.pojo.Teacher;

import java.util.ArrayList;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;

/**
 * @version 1.0
 * @author: woo hua
 * @DATE 2022/9/14 9:45
 * @description:
 */
public class ListStream {

    public static void main(String[] args) {
        ArrayList<Teacher> list = new ArrayList<>();
        list.add(new Teacher(1, "李"));
        list.add(new Teacher(2, "章"));
        list.add(new Teacher(3, "王"));
        list.add(new Teacher(4, "谢"));

        list = null;

        Map<Integer, String> collect = Optional.ofNullable(list).orElseGet(ArrayList::new)
                .stream().collect(Collectors.toMap(Teacher::getId, Teacher::getName));
        System.out.println(collect);

        Integer aLong = null;
        Integer bLong = null;
        System.out.println(aLong.equals(bLong));
    }
}
